#ifndef __GAMESERVERSENDER_H__
#define __GAMESERVERSENDER_H__

#include "gwmessagemap.hpp"
#include "IMessageOperator.h"
#include "protonet.hpp"
#include "netlib.h"
#include "../NetMessage.h"
#include "gameserver.pb.h"

/**
*@file       GameServerSender.h
*@brief      send message GameServer
*
*@author     graywind
*@version    1.0.0.0
*@data       2012/3/16
*/

///message wrapper
class msgGameServer
{
public:
    static const int MessageId = GameServer;
    //TODO
    pnSessionHandle   SessionId;
    GameServerMain    MainMsg;
    ///@brief     constructor
    ///param[in]  session_id      identifier of the session
    ///param[in]  sub_id          sub message id
    ///param[in]  buffer          sub message buffer
    msgGameServer(int session_id, int sub_id, const std::string& buffer):
    SessionId(session_id)
    {
        MainMsg.set_subid(sub_id);
        MainMsg.set_subbuffer(buffer);
    }
};

class HandleGameServer
{
public:
    ///@brief     handle message
    ///param[in]  msg     message wrapper of GameServer
    ///retval     void
    static void HandleMessage(msgGameServer* msg)
    {
        //TODO
        ProtoNet<GameServerMain>::Send(msg->SessionId, msgGameServer::MessageId, msg->MainMsg);
    }
};
///[message wrapper]  [handler]
RegisterHandler(msgGameServer, HandleGameServer);

#endif
